package com.nufront.bloodsugar;

import java.util.Random;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.nufront.bloodsugar.model.DragButton;
import com.nufront.bloodsugar.view.LineChart;

public class BloodSugar extends Activity implements OnClickListener {

	private DragButton dragButton;
	private LineChart lineChart;
	private Random random;
	private Button diagnosisBt;
	private Button testButton;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		findMyView();
		setMyClickListener();
	}

	private void findMyView() {
		//dragButton = (DragButton) findViewById(R.id.mDragButton);
		lineChart = (LineChart) findViewById(R.id.lineChart);
		diagnosisBt = (Button) findViewById(R.id.diagnosis);
		testButton = (Button) findViewById(R.id.testButton);
		random = new Random();
	}

	private void setMyClickListener() {
		//dragButton.setCurrentTab(1, true);
		diagnosisBt.setOnClickListener(this);
		testButton.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.diagnosis:
			//lineChart.addSeries(random.nextInt(30));
			break;
			
		case R.id.testButton:
			lineChart.addSeries(random.nextInt(30));
			break;

		default:
			break;
		}
	}
}
